package thinkingJava.chapter11;

import java.util.HashMap;
import java.util.Map;

import thinkingJava.chapter14.Cat;
import thinkingJava.chapter14.Dog;
import thinkingJava.chapter14.Hamster;
import thinkingJava.chapter14.Pet;

public class PetMap {
	public static void main(String[] args) {

		Map<String,Pet> petMap = new HashMap<String,Pet>();

		petMap.put("My Cat", new Cat("Molly"));
		petMap.put("My Dog", new Dog("Jungely"));
		petMap.put("My Hamster", new Hamster("Mosoco"));

		print(petMap);

		Pet dog = petMap.get("My Dog");
		print(dog);

		print("pet ContainsKey myCat ? " + petMap.containsKey("My Cat"));
		print("pet ContainsValue dog ? " + petMap.containsValue(dog));
	}
	public static void print(Object o) {
		System.out.println(o);
	}
}
